import Cookies from "js-cookie";

const TokenKey = "hrm_token";
const Tktimeout = "hrm_tktimeout"; // 保存token过期的时间（主动处理token失效）

export function getToken() {
  return Cookies.get(TokenKey);
}

export function setToken(token) {
  Cookies.set(TokenKey, token);
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}

export function setTimeStamp() {
  Cookies.set(Tktimeout, Date.now() + 30 * 60 * 1000); //半个小时后失效
}

export function getTimeStamp() {
  return Cookies.get(Tktimeout);
}
